﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace ImageRecognition2.Forms
{
    /// <summary>
    /// Form to input a threshold
    /// </summary>
    public partial class FormThresholdInput : Form
    {
        //private bool m_bThresholdOnly = false;

        /// <summary>
        /// Initializes a new instance of the <see cref="FormThresholdInput"/> class.
        /// </summary>
        public FormThresholdInput()
        {
            InitializeComponent();
        }

        /// <summary>
        /// Hides the check box.
        /// </summary>
        /// <param name="_bHide">if set to <c>true</c> [_b hide].</param>
        public void HideCheckBox(bool _bHide)
        {
            this.chkbOnlyThisThreshold.Visible = !_bHide;
        }

        /// <summary>
        /// Gets or sets a value indicating whether [threshold only].
        /// </summary>
        /// <value><c>true</c> if [threshold only]; otherwise, <c>false</c>.</value>
        public bool ThresholdOnly
        {
            get { return chkbOnlyThisThreshold.Checked; }
            set { chkbOnlyThisThreshold.Checked = value; }
        }

        /// <summary>
        /// Gets or sets the threshold.
        /// </summary>
        /// <value>The threshold.</value>
        public int Threshold
        {
            get { return (Convert.ToInt32(tbThreshold.Text, 10)); }
            set { tbThreshold.Text = value.ToString(); }
        }

        /// <summary>
        /// Handles the Click event of the cbOK control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param>
        private void cbOK_Click(object sender, EventArgs e)
        {
            this.DialogResult = DialogResult.OK;
            this.Close();
        }

        /// <summary>
        /// Handles the Click event of the cbCancel control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param>
        private void cbCancel_Click(object sender, EventArgs e)
        {
            this.DialogResult = DialogResult.Cancel;
            this.Close();
        }
    }
}
